const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const ProfileSchema = new Schema({
  profile_state: { type: String }, // 报账中 || 已收账
  profile_title: { type: String }, // 项目名称
  create_time: { type: Date, default: Date.now }, // 报账时间
  finish_time: { type: Date }, // 收款时间
  persons: [
    {
      person: { type: mongoose.Types.ObjectId, ref: "users" },
      money: { type: String },
    },
  ], // 每人及其金额
  amount: { type: String }, // 报账总金额
});

module.exports = Profile = mongoose.model("profile", ProfileSchema);
